<template>
  <div class="dialog-button">
    <el-dialog
      :title="title"
      :visible.sync="showDialog"
      append-to-body
    >
      <component
        :is="moduleComponent"
        ref="dynimacForm"
        :primary-key="primaryKey"
        :submit-button-text="submitButtonText"
      >
        <slot />
      </component>
    </el-dialog>
  </div>
</template>

<script>
// import Maps from '@/components/Maps'
export default {
  name: 'DialogForm',
  components: {},
  props: {
    value: {
      type: Boolean,
      default: null
    },
    title: {
      type: String,
      default: 'CodeMirror'
    },
    moduleComponent: {
      type: Function,
      default: () => {}
    },
    primaryKey: {
      type: [String, Number],
      default: ''
    },
    labelPosition: {
      type: String,
      default: ''
    },
    labelWidth: {
      type: String,
      default: '20%'
    },
    labelSuffix: {
      type: String,
      default: ''
    },
    size: {
      type: String,
      default: ''
    },
    submitButtonText: {
      type: String,
      default: '提交保存'
    }
  },
  data() {
    return {
      saving: false,
      activeIndex: undefined
    }
  },
  computed: {
    showDialog: {
      get() {
        return this.value
      },
      set(val) {
        this.$emit('input', val)
      }
    }
  },
  created() {
    console.log(this)
  },
  methods: {}
}
</script>

<style lang="scss">
</style>
